package br.com.slsystems.travianbot;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

import br.com.slsystems.travianbot.view.ApplicationWorkbenchWindowAdvisor;
import br.com.slsystems.travianbot.view.Perspective;

public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
	
    public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
        return new ApplicationWorkbenchWindowAdvisor(configurer);
    }

	public String getInitialWindowPerspectiveId() {
		return Perspective.ID;
	}
	
	public boolean preShutdown() {  
		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();  
	    String dialogBoxTitle = "Question";  
	    String question = "Are you sure you want to close TravianBot?";  
	    return MessageDialog.openQuestion(shell, dialogBoxTitle, question);  
	}	
}
